Fix Bug: get_geo_submit_flag result error

Brightcells 8 年之前
父节点
当前提交
5d13ae0917
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      group/tourguidegroupuser_views.py

+ 3 - 1
group/tourguidegroupuser_views.py

@@ -221,6 +221,8 @@ def tgu_group_user_update_api(request):
221 221
 def get_geo_submit_flag(geo_at, gather_at):
222 222
     """ 是否上传过位置字段(即是否失联) """
223 223
     if geo_at and gather_at:
224
+        geo_at = tc.string_to_utc_datetime(geo_at, format='%Y-%m-%dT%H:%M:%SZ')
225
+        gather_at = tc.string_to_utc_datetime(gather_at, format='%Y-%m-%dT%H:%M:%SZ')
224 226
         current_dt = tc.utc_datetime()
225 227
         delta_seconds = tc.total_seconds(gather_at - current_dt)
226 228
         # 距离集合时间超过30分钟是5分钟,15分钟到30分钟是3分钟,15分钟以内是1分钟
@@ -255,7 +257,7 @@ def tgu_group_user_locations_api(request):
255 257
         'lon': loc[2][0],
256 258
         'lat': loc[2][1],
257 259
         'dist': loc[1],
258
-        'geo_submited': get_geo_submit_flag(tc.utc_string_to_utc_datetime(geo_dts.get(loc[0], '')), gather_info.get('gather_at', '')),
260
+        'geo_submited': get_geo_submit_flag(geo_dts.get(loc[0], ''), gather_info.get('gather_at', '')),
259 261
     }) for loc in locations]
260 262
 
261 263
     return response(200, 'Get Tour Guide Group All User Location Success', u'获取旅行团成员地理位置信息成功', {